﻿/*
 * ChsMS.exe  ---- 一个工具箱软件
 * Copyright (C) 2023 马中周
 *
 * 本程序是免费的;依据 apache2 协议。
 *
 * 这个程序是我自身的学习和实验性产品所以会有些生涩。不保证功能的适配，以及针对其他环境的适用性。
 *
 * 如果有幸想与我交流想法可以发邮件给我：my136@263.net
 *
 * */

#include "createalotofpasswords.h"
#include <BaseChMushSte/nameSpaces_cmst.h>  // 小鸡炖蘑菇公共函数库
#include <chrono>  // std::chrono::time_point<>
#include <random>
#include <algorithm> // std::shuffle()
#include <array>
#include <string>

#include <chmslog.h>

/*
 * 对象计数器
 * */
int CreateALotOfPasswords::sNewCounter = 0;

// 全字符表(字母 + 数字 + 所有标点符号)
const std::map<int,std::string> CreateALotOfPasswords::kaMapOfAlpNumAllPun = {
    {33,"!"},{34,"\""},{35,"#"},{36,"$"},{37,"%"},{38,"&"},{39,"'"},{40,"("},{41,")"},{42,"*"},{43,"+"},{44,","},{45,"-"},
    {46,"."},{48,"0"},{49,"1"},{50,"2"},{51,"3"},{52,"4"},{53,"5"},{54,"6"},{55,"7"},{56,"8"},{57,"9"},{58,":"},{59,";"},
    {60,"<"},{61,"="},{62,">"},{63,"?"},{64,"@"},
    {65,"A"},{66,"B"},{67,"C"},{68,"D"},{69,"E"},{70,"F"},{71,"G"},{72,"H"},{73,"I"},{74,"J"},{75,"K"},{76,"L"},{77,"M"},
    {78,"N"},{79,"O"},{80,"P"},{81,"Q"},{82,"R"},{83,"S"},{84,"T"},{85,"U"},{86,"V"},{87,"W"},{88,"X"},{89,"Y"},{90,"Z"},
    {91,"["},{93,"]"},{94,"^"},{95,"_"},{96,"`"},
    {97,"a"},{98,"b"},{99,"c"},{100,"d"},{101,"e"},{102,"f"},{103,"g"},{104,"h"},{105,"i"},{106,"j"},{107,"k"},{108,"l"},{109,"m"},
    {110,"n"},{111,"o"},{112,"p"},{113,"q"},{114,"r"},{115,"s"},{116,"t"},{117,"u"},{118,"v"},{119,"w"},{120,"x"},{121,"y"},{122,"z"},
    {123,"{"},{124,"|"},{125,"}"},{126,"~"}
};

// 字母 + 数字 + 常用标点符号 -> 键值表
const std::array<int,72> CreateALotOfPasswords::kaArrOfAlpNumComPun_key = {
    33,35,36,37,38,43,44,46,48,49,50,51,52,53,54,55,56,57,64,65,66,67,68,69,
    70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,95,97,98,
    99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122
};
// 字母 + 数字 + 常用标点符号 -> 元素表
const std::array<char,72> CreateALotOfPasswords::kaArrOfAlpNumComPun_elem = {
    'A','B','C','D','E','F','G','H','I','J','K','L','M',
    'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
    'a','b','c','d','e','f','g','h','i','j','k','l','m',
    'n','o','p','q','r','s','t','u','v','w','x','y','z',
    '0','1','2','3','4','5','6','7','8','9',
    '!','#','$','%','&','+',',','.','@','_'
};

// 字母 + 数字 + 部分标点符号 -> 键值表
const std::array<int,84> CreateALotOfPasswords::kaArrOfAlpNumSmallPun_key = {
    33,35,36,37,38,40,41,43,44,45,46,48,49,50,51,52,53,54,55,56,57,
    59,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,
    83,84,85,86,87,88,89,90,91,93,94,95,96,97,98,99,100,101,102,103,104,
    105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,125,126
};
// 字母 + 数字 + 部分标点符号 -> 元素表
const std::array<char,84> CreateALotOfPasswords::kaArrOfAlpNumSmallPun_elem = {
    'A','B','C','D','E','F','G','H','I','J','K','L','M',
    'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
    'a','b','c','d','e','f','g','h','i','j','k','l','m',
    'n','o','p','q','r','s','t','u','v','w','x','y','z',
    '0','1','2','3','4','5','6','7','8','9',
    '!','#','$','%','&','(',')','+','-',',','.',
    ';','=','@','[',']','^','_','`','{','}','~'
};

// 字母 + 数字 + 全部标点符号 -> 键值表
const std::array<int,92> CreateALotOfPasswords::kaArrOfAlpNumAllPun_key = {
    33,34,35,36,37,38,39,40,41,42,43,44,45,46,48,49,50,51,52,53,54,55,56,
    57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
    80,81,82,83,84,85,86,87,88,89,90,91,93,94,95,96,97,98,99,100,101,102,103,
    104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126
};
// 字母 + 数字 + 全部标点符号 -> 元素表
const std::array<char,92> CreateALotOfPasswords::kaArrOfAlpNumAllPun_elem = {
    'A','B','C','D','E','F','G','H','I','J','K','L','M',
    'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
    'a','b','c','d','e','f','g','h','i','j','k','l','m',
    'n','o','p','q','r','s','t','u','v','w','x','y','z',
    '0','1','2','3','4','5','6','7','8','9',
    '!','\"','#','$','%','&','\'','(',')','*',
    '+',',','-','.',':',';','<','=','>','\?',
    '@','[',']','^','_','`','{','|','}','~'
};

// 字母表 -> 键值表
const std::array<int,52> CreateALotOfPasswords::kaArrOfAlphabet_Key = {
    65,66,67,68,69,70,71,72,73,74,75,76,77,
    78,79,80,81,82,83,84,85,86,87,88,89,90,
    97,98,99,100,101,102,103,104,105,106,107,108,109,
    110,111,112,113,114,115,116,117,118,119,120,121,122
};
// 字母表 -> 元素表
const std::array<char,52> CreateALotOfPasswords::kaArrOfAlphabet_elem = {
    'A','B','C','D','E','F','G','H','I','J','K','L','M',
    'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
    'a','b','c','d','e','f','g','h','i','j','k','l','m',
    'n','o','p','q','r','s','t','u','v','w','x','y','z'
};

// 数字列表 -> 键值表
const std::array<int,10> CreateALotOfPasswords::kaArrOfNumbers_Key = {
    48,49,50,51,52,53,54,55,56,57
};

// 字母 + 数字 -> 键值表
const std::array<int,62> CreateALotOfPasswords::kaArrOfAlpNum_key = {
    48,49,50,51,52,53,54,55,56,57,
    65,66,67,68,69,70,71,72,73,74,75,76,77,
    78,79,80,81,82,83,84,85,86,87,88,89,90,
    97,98,99,100,101,102,103,104,105,106,107,108,109,
    110,111,112,113,114,115,116,117,118,119,120,121,122
};
// 字母 + 数字 -> 元素表
const std::array<char,62> CreateALotOfPasswords::kaArrOfAlpNum_elem = {
    'A','B','C','D','E','F','G','H','I','J','K','L','M',
    'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
    'a','b','c','d','e','f','g','h','i','j','k','l','m',
    'n','o','p','q','r','s','t','u','v','w','x','y','z',
    '0','1','2','3','4','5','6','7','8','9'
};

// 十六进制数 -> 键值表
const std::array<int,16> CreateALotOfPasswords::kaArrOfHexadecimal = {
    48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70
};
// 十六进制数 -> 元素表
const std::array<char,16> CreateALotOfPasswords::kaArrOfHexadecimal_elem = {
    '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
};


CreateALotOfPasswords::CreateALotOfPasswords()
{

}

CreateALotOfPasswords::~CreateALotOfPasswords()
{

}

// 真随机密码生产函数
std::string CreateALotOfPasswords::funStrOfProdRanNumPasswds(const int &a, const int &b) const
{
    // 存储生成的密码
    std::string varStrOfPasswd = "";
    // 字母 + 数字 + 常用标点符号
    std::string varStrTemp1 = "";
    // 字母 + 数字 + 部分标点符号
    std::string varStrTemp2 = "";
    // 字母 + 数字 + 全部标点符号
    std::string varStrTemp3 = "";
    // 字母 + 数字
    std::string varStrTemp4 = "";
    // 十六进制
    std::string varStrTemp5 = "";

    if(a < 10){
        varStrOfPasswd = "Length of password Less than 10";
        return varStrOfPasswd;
    }

    if(b < 1 || b > 5){
        varStrOfPasswd = "Type selection error";
        return varStrOfPasswd;
    }

    switch(b)
    {
    case 1:
        do
        {
            if(!varStrOfPasswd.empty()){ // 用于密码强度不合格时，重新获取密码的初始化。
                varStrOfPasswd = "";
            }

            for(int i = 0 ; i < a ;++i){  // 密码生产循环
                varStrOfPasswd += CreateALotOfPasswords::funStrOfProdRanChar(b);
            }

        }while(cms::funIntOfCompositonAnalysis(varStrOfPasswd) != 1111);
        break;
    case 2:
        do
        {
            if(!varStrOfPasswd.empty()){
                varStrOfPasswd = "";
            }

            for(int i = 0 ; i < a ;++i){
                varStrOfPasswd += CreateALotOfPasswords::funStrOfProdRanChar(b);
            }

        }while(cms::funIntOfCompositonAnalysis(varStrOfPasswd) != 1111);
        break;
    case 3:
        do
        {
            if(!varStrOfPasswd.empty()){
                varStrOfPasswd = "";
            }

            for(int i = 0 ; i < a ;++i){
                varStrOfPasswd += CreateALotOfPasswords::funStrOfProdRanChar(b);
            }

        }while(cms::funIntOfCompositonAnalysis(varStrOfPasswd) != 1111);
        break;
    case 4:
        do
        {
            if(!varStrOfPasswd.empty()){
                varStrOfPasswd = "";
            }

            for(int i = 0 ; i < a ;++i){
                varStrOfPasswd += CreateALotOfPasswords::funStrOfProdRanChar(b);
            }

        }while(cms::funIntOfCompositonAnalysis(varStrOfPasswd) != 111);
        break;
    case 5:
        do
        {
            if(!varStrOfPasswd.empty()){
                varStrOfPasswd = "";
            }

            for(int i = 0 ; i < a ;++i){
                varStrOfPasswd += CreateALotOfPasswords::funStrOfProdRanChar(b);
            }

        }while(cms::funIntOfCompositonAnalysis(varStrOfPasswd) != 101);
        break;
    default:
        varStrOfPasswd = "An unexpected selection type occurred!";
        break;
    }
    return varStrOfPasswd;
}

// 生成复合型最终密码
std::string CreateALotOfPasswords::funStrOfFreshPasswdCC(const int &a, const int &b) const
{
    // 存储生成的密码
    std::string varStrOfPasswd = "";

    // 字母 + 数字 + 常用标点符号
    std::string varStrTemp1 = "";
    // 字母 + 数字 + 部分标点符号
    std::string varStrTemp2 = "";
    // 字母 + 数字 + 全部标点符号
    std::string varStrTemp3 = "";
    // 字母 + 数字
    std::string varStrTemp4 = "";

    if(a < 10){
        varStrOfPasswd = "Length of password Less than 10";
        return varStrOfPasswd;
    }

    if(b < 1 || b > 4){
        varStrOfPasswd = "Type selection error";
        return varStrOfPasswd;
    }

    switch(b)
    {
    case 1:
        do
        {
            if(!varStrOfPasswd.empty()){
                varStrOfPasswd = "";
            }

            // 判断首字符是不是字母或者数字
            do
            {

                // 获取原始密码
                varStrTemp1 = CreateALotOfPasswords::funStrOfAlpNumComPun();
            }while(!cms::funStrOfInitialDetection(varStrTemp1));

            // 判断密码长度需求是不是超长
            if(a <= 72){
                // 生成密码
                for(int i = 0;i < a;++i){
                    varStrOfPasswd += varStrTemp1[i];
                }
            }else if(a > 72 && a <= 504){
                varStrTemp1 += CreateALotOfPasswords::funStrOfAlpNumComPun();
                varStrTemp1 += CreateALotOfPasswords::funStrOfAlpNumComPun();
                varStrTemp1 += CreateALotOfPasswords::funStrOfAlpNumComPun();
                varStrTemp1 += CreateALotOfPasswords::funStrOfAlpNumComPun();
                varStrTemp1 += CreateALotOfPasswords::funStrOfAlpNumComPun();
                varStrTemp1 += CreateALotOfPasswords::funStrOfAlpNumComPun();
                // 生成密码
                for(int i = 0;i < a;++i){
                    varStrOfPasswd += varStrTemp1[i];
                }
            }else{
                varStrOfPasswd = "Length of password greater than 504";
                return varStrOfPasswd;
            }
        }while(cms::funIntOfCompositonAnalysis(varStrOfPasswd) != 1111);
        break;
    case 2:
        do
        {
            if(!varStrOfPasswd.empty()){
                varStrOfPasswd = "";
            }

            // 判断首字符是不是字母或者数字
            do
            {
                // 获取原始密码
                varStrTemp2 = CreateALotOfPasswords::funStrOfAlpNumSmallPun();
            }while(!cms::funStrOfInitialDetection(varStrTemp2));

            // 判断密码长度需求是不是超长
            if(a <= 84){
                // 生成密码
                for(int i = 0;i < a;++i){
                    varStrOfPasswd += varStrTemp2[i];
                }
            }else if(a > 84 && a <= 504){
                varStrTemp2 += CreateALotOfPasswords::funStrOfAlpNumSmallPun();
                varStrTemp2 += CreateALotOfPasswords::funStrOfAlpNumSmallPun();
                varStrTemp2 += CreateALotOfPasswords::funStrOfAlpNumSmallPun();
                varStrTemp2 += CreateALotOfPasswords::funStrOfAlpNumSmallPun();
                varStrTemp2 += CreateALotOfPasswords::funStrOfAlpNumSmallPun();
                // 生成密码
                for(int i = 0;i < a;++i){
                    varStrOfPasswd += varStrTemp2[i];
                }
            }else{
                varStrOfPasswd = "Length of password greater than 504";
                return varStrOfPasswd;
            }
        }while(cms::funIntOfCompositonAnalysis(varStrOfPasswd) != 1111);
        break;
    case 3:
        do
        {
            if(!varStrOfPasswd.empty()){
                varStrOfPasswd = "";
            }

            // 判断首字符是不是字母或者数字
            do
            {
                // 获取原始密码
                varStrTemp3 = CreateALotOfPasswords::funStrOfAlpNumAllPun();
            }while(!cms::funStrOfInitialDetection(varStrTemp3));

            // 判断密码长度需求是不是超长
            if(a <= 92){
                // 生成密码
                for(int i = 0;i < a;++i){
                    varStrOfPasswd += varStrTemp3[i];
                }
            }else if(a > 92 && a <= 552){
                varStrTemp3 += CreateALotOfPasswords::funStrOfAlpNumAllPun();
                varStrTemp3 += CreateALotOfPasswords::funStrOfAlpNumAllPun();
                varStrTemp3 += CreateALotOfPasswords::funStrOfAlpNumAllPun();
                varStrTemp3 += CreateALotOfPasswords::funStrOfAlpNumAllPun();
                varStrTemp3 += CreateALotOfPasswords::funStrOfAlpNumAllPun();
                // 生成密码
                for(int i = 0;i < a;++i){
                    varStrOfPasswd += varStrTemp3[i];
                }
            }else{
                varStrOfPasswd = "Length of password greater than 552";
                return varStrOfPasswd;
            }
        }while(cms::funIntOfCompositonAnalysis(varStrOfPasswd) != 1111);
        break;
    case 4:
        do
        {
            if(!varStrOfPasswd.empty()){
                varStrOfPasswd = "";
            }

            varStrTemp4 = CreateALotOfPasswords::funStrOfAlpNum();

            // 判断密码长度需求是不是超长
            if(a <= 62){
                // 生成密码
                for(int i = 0;i < a;++i){
                    varStrOfPasswd += varStrTemp4[i];
                }
            }else if(a > 62 && a <= 558){
                varStrTemp4 += CreateALotOfPasswords::funStrOfAlpNum();
                varStrTemp4 += CreateALotOfPasswords::funStrOfAlpNum();
                varStrTemp4 += CreateALotOfPasswords::funStrOfAlpNum();
                varStrTemp4 += CreateALotOfPasswords::funStrOfAlpNum();
                varStrTemp4 += CreateALotOfPasswords::funStrOfAlpNum();
                varStrTemp4 += CreateALotOfPasswords::funStrOfAlpNum();
                varStrTemp4 += CreateALotOfPasswords::funStrOfAlpNum();
                varStrTemp4 += CreateALotOfPasswords::funStrOfAlpNum();
                // 生成密码
                for(int i = 0;i < a;++i){
                    varStrOfPasswd += varStrTemp4[i];
                }
            }else{
                varStrOfPasswd = "Length of password greater than 558";
                return varStrOfPasswd;
            }
        }while(cms::funIntOfCompositonAnalysis(varStrOfPasswd) != 111);
        break;
    default:
        varStrOfPasswd = "An unexpected selection type occurred!";
        break;
    }

    return varStrOfPasswd;
}


// 字母 + 数字 + 常用标点符号 原始长度密码
std::string CreateALotOfPasswords::funStrOfAlpNumComPun() const
{
    // 存储原始密码
    std::string varStrOfPasswd = "";

    std::array<int,72> varArrOfTemp1 = CreateALotOfPasswords::kaArrOfAlpNumComPun_key;

    // 获取当前时间点作为随机数生成器种子
    typedef std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds> microClock_type;
    microClock_type tp = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());

    // 生产随机数种子
    std::mt19937_64 randomNumber_mt19937_64(tp.time_since_epoch().count());

    // 对数组进行随机洗牌
    std::shuffle(varArrOfTemp1.begin(),varArrOfTemp1.end(),randomNumber_mt19937_64);

    for(int i = 0;i < 72;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp1[i])->second);
    }
    return varStrOfPasswd;
}

// 字母 + 数字 + 部分标点符号 原始长度密码
std::string CreateALotOfPasswords::funStrOfAlpNumSmallPun() const
{
    // 存储原始密码
    std::string varStrOfPasswd = "";

    std::array<int,84> varArrOfTemp1 = CreateALotOfPasswords::kaArrOfAlpNumSmallPun_key;

    // 获取当前时间点作为随机数生成器种子
    typedef std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds> microClock_type;
    microClock_type tp = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());

    // 生产随机数种子
    std::mt19937_64 randomNumber_mt19937_64(tp.time_since_epoch().count());

    // 对数组进行随机洗牌
    std::shuffle(varArrOfTemp1.begin(),varArrOfTemp1.end(),randomNumber_mt19937_64);

    for(int i = 0;i < 84;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp1[i])->second);
    }
    return varStrOfPasswd;
}

// 字母 + 数字 + 全部标点符号 原始长度密码
std::string CreateALotOfPasswords::funStrOfAlpNumAllPun() const
{
    // 存储原始密码
    std::string varStrOfPasswd = "";

    std::array<int,92> varArrOfTemp1 = CreateALotOfPasswords::kaArrOfAlpNumAllPun_key;

    // 获取当前时间点作为随机数生成器种子
    typedef std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds> microClock_type;
    microClock_type tp = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());

    // 生产随机数种子
    std::mt19937_64 randomNumber_mt19937_64(tp.time_since_epoch().count());

    // 对数组进行随机洗牌
    std::shuffle(varArrOfTemp1.begin(),varArrOfTemp1.end(),randomNumber_mt19937_64);

    for(int i = 0;i < 92;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp1[i])->second);
    }
    return varStrOfPasswd;
}

// 字母表 原始长度密码
std::string CreateALotOfPasswords::funStrOfAlphabet() const
{
    // 存储原始密码
    std::string varStrOfPasswd = "";

    std::array<int,52> varArrOfTemp1 = CreateALotOfPasswords::kaArrOfAlphabet_Key;

    // 获取当前时间点作为随机数生成器种子
    typedef std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds> microClock_type;
    microClock_type tp = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());

    // 生产随机数种子
    std::mt19937_64 randomNumber_mt19937_64(tp.time_since_epoch().count());

    // 对数组进行随机洗牌
    std::shuffle(varArrOfTemp1.begin(),varArrOfTemp1.end(),randomNumber_mt19937_64);

    for(int i = 0;i < 52;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp1[i])->second);
    }
    return varStrOfPasswd;
}

// 数字列表 原始长度密码
std::string CreateALotOfPasswords::funStrOfNumbers() const
{
    // 存储原始密码
    std::string varStrOfPasswd = "";

    std::array<int,10> varArrOfTemp1 = CreateALotOfPasswords::kaArrOfNumbers_Key;

    // 获取当前时间点作为随机数生成器种子
    typedef std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds> microClock_type;
    microClock_type tp = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());

    // 生产随机数种子
    std::mt19937_64 randomNumber_mt19937_64(tp.time_since_epoch().count());

    // 对数组进行随机洗牌
    std::shuffle(varArrOfTemp1.begin(),varArrOfTemp1.end(),randomNumber_mt19937_64);

    for(int i = 0;i < 10;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp1[i])->second);
    }
    return varStrOfPasswd;
}

// 字母 + 数字 原始长度密码
std::string CreateALotOfPasswords::funStrOfAlpNum() const
{
    // 存储原始密码
    std::string varStrOfPasswd = "";

    std::array<int,62> varArrOfTemp1 = CreateALotOfPasswords::kaArrOfAlpNum_key;

    // 获取当前时间点作为随机数生成器种子
    typedef std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds> microClock_type;
    microClock_type tp = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());

    // 生产随机数种子
    std::mt19937_64 randomNumber_mt19937_64(tp.time_since_epoch().count());

    // 对数组进行随机洗牌
    std::shuffle(varArrOfTemp1.begin(),varArrOfTemp1.end(),randomNumber_mt19937_64);

    for(int i = 0;i < 62;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp1[i])->second);
    }
    return varStrOfPasswd;
}

// 32位十六进制
std::string CreateALotOfPasswords::funStrOfHexadecimal32() const
{
    // 存储原始密码
    std::string varStrOfPasswd = "";

    std::array<int,16> varArrOfTemp1 = CreateALotOfPasswords::kaArrOfHexadecimal;
    std::array<int,16> varArrOfTemp2 = CreateALotOfPasswords::kaArrOfHexadecimal;

    // 获取当前时间点作为随机数生成器种子
    typedef std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds> microClock_type;
    microClock_type tp = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());

    // 生产随机数种子
    std::mt19937_64 randomNumber_mt19937_64(tp.time_since_epoch().count());

    // 对数组进行随机洗牌
    std::shuffle(varArrOfTemp1.begin(),varArrOfTemp1.end(),randomNumber_mt19937_64);
    std::shuffle(varArrOfTemp2.begin(),varArrOfTemp2.end(),randomNumber_mt19937_64);



    for(int i = 0;i < 16;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp1[i])->second);
    }

    for(int i = 0;i < 16;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp2[i])->second);
    }


    return varStrOfPasswd;
}

// 64位十六进制
std::string CreateALotOfPasswords::funStrOfHexadecimal64() const
{
    // 存储原始密码
    std::string varStrOfPasswd = "";

    std::array<int,16> varArrOfTemp1 = CreateALotOfPasswords::kaArrOfHexadecimal;
    std::array<int,16> varArrOfTemp2 = CreateALotOfPasswords::kaArrOfHexadecimal;
    std::array<int,16> varArrOfTemp3 = CreateALotOfPasswords::kaArrOfHexadecimal;
    std::array<int,16> varArrOfTemp4 = CreateALotOfPasswords::kaArrOfHexadecimal;

    // 获取当前时间点作为随机数生成器种子
    typedef std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds> microClock_type;
    microClock_type tp = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());

    // 生产随机数种子
    std::mt19937_64 randomNumber_mt19937_64(tp.time_since_epoch().count());

    // 对数组进行随机洗牌
    std::shuffle(varArrOfTemp1.begin(),varArrOfTemp1.end(),randomNumber_mt19937_64);
    std::shuffle(varArrOfTemp2.begin(),varArrOfTemp2.end(),randomNumber_mt19937_64);
    std::shuffle(varArrOfTemp3.begin(),varArrOfTemp3.end(),randomNumber_mt19937_64);
    std::shuffle(varArrOfTemp4.begin(),varArrOfTemp4.end(),randomNumber_mt19937_64);

    for(int i = 0;i < 16;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp1[i])->second);
    }

    for(int i = 0;i < 16;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp2[i])->second);
    }

    for(int i = 0;i < 16;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp3[i])->second);
    }

    for(int i = 0;i < 16;++i){
        varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTemp4[i])->second);
    }


    return varStrOfPasswd;
}

/*
 * 1* 16 至 256 * 16 位的十六进制
 * k 值只接受 1 - 256 之间的偶数，1除外。
 * */
std::string CreateALotOfPasswords::funStrOfHexadecimalXX(const int &k) const
{
    // 存储原始密码
    std::string varStrOfPasswd = "";
    // 复制十六进制数字表
    std::array<int,16> varArrOfTempXX = CreateALotOfPasswords::kaArrOfHexadecimal;

    /*
     *  k 值检测处理
     * */
    if(k == 1){
        goto ONLY1;
    }
    // 判断 k 值是否为偶数
    if(k % 2 != 0){
        varStrOfPasswd = "Only even numbers are accepted, except 1 ";
        return varStrOfPasswd;
    }
    ONLY1:
    // 判断 k 值大小
    if(k < 1 || k > 256){
        varStrOfPasswd = "Input error!";
        return varStrOfPasswd;
    }

    // 获取当前时间点作为随机数生成器种子
    typedef std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds> microClock_type;
    microClock_type tp = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());

    // 生产随机数种子
    std::mt19937_64 randomNumber_mt19937_64(tp.time_since_epoch().count());

    for(int m = 0;m < k;++m){

        std::shuffle(varArrOfTempXX.begin(),varArrOfTempXX.end(),randomNumber_mt19937_64);

        for(int i = 0;i < 16;++i){
            varStrOfPasswd.append(CreateALotOfPasswords::kaMapOfAlpNumAllPun.find(varArrOfTempXX[i])->second);
        }
    }

    return varStrOfPasswd;

}

// 生成单个char类型随机字符，是组成字符串的元素
char CreateALotOfPasswords::funStrOfProdRanChar(const int &b) const
{
    /*
     * 函数返回值。
     *
     * 正常的返回值是数组当中的字符。
     *
     * 如果返回值是24，说明函数参数输入不正确。
     * */
    char varChar = 24;

    // 获取数组
    std::array<char,72> varArrOfTemp1 = {24};
    std::array<char,84> varArrOfTemp2 = {24};
    std::array<char,92> varArrOfTemp3 = {24};
    std::array<char,62> varArrOfTemp4 = {24};
    std::array<char,16> varArrOfTemp5 = {24};


    /*
     * 用于生产真随机数的生成器
     * */
    std::random_device rd;
    std::mt19937_64 gen(rd());

    /*
     * 用于洗牌的随机数生成器
     * */
    // 获取当前时间点作为随机数生成器种子
    typedef std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds> microClock_type;
    microClock_type tp = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());
    // 生产随机数种子
    std::mt19937_64 randomNumber_mt19937_64(tp.time_since_epoch().count());

    switch(b){
    case 1:
        do{
            varArrOfTemp1 = CreateALotOfPasswords::kaArrOfAlpNumComPun_elem; // 取字符串组成的元素数组
            //std::uniform_int_distribution<int> distr(0, varArrOfTemp1.size()-1); // 在数组长度范围内随机获取一个数值
            std::uniform_int_distribution<long long> distr(0, varArrOfTemp1.size()-1);

            std::shuffle(varArrOfTemp1.begin(),varArrOfTemp1.end(),randomNumber_mt19937_64); // 对数组进行洗牌

            varChar = varArrOfTemp1[distr(gen)]; // 用获得的随机数从已经洗过牌的数组相对应的位置取得字符。

        }while(false);
        break;
    case 2:
        do{
            varArrOfTemp2 = CreateALotOfPasswords::kaArrOfAlpNumSmallPun_elem;
            //std::uniform_int_distribution<int> distr(0, varArrOfTemp2.size()-1);
            std::uniform_int_distribution<long long> distr(0, varArrOfTemp2.size()-1);
            std::shuffle(varArrOfTemp2.begin(),varArrOfTemp2.end(),randomNumber_mt19937_64);

            varChar = varArrOfTemp2[distr(gen)];

        }while(false);
        break;
    case 3:
        do{
            varArrOfTemp3 = CreateALotOfPasswords::kaArrOfAlpNumAllPun_elem;
            //std::uniform_int_distribution<int> distr(0, varArrOfTemp3.size()-1);
            std::uniform_int_distribution<long long> distr(0, varArrOfTemp3.size()-1);
            std::shuffle(varArrOfTemp3.begin(),varArrOfTemp3.end(),randomNumber_mt19937_64);

            varChar = varArrOfTemp3[distr(gen)];

        }while(false);
        break;
    case 4:
        do{
            varArrOfTemp4 = CreateALotOfPasswords::kaArrOfAlpNum_elem;
            //std::uniform_int_distribution<int> distr(0, varArrOfTemp4.size()-1);
            std::uniform_int_distribution<long long> distr(0, varArrOfTemp4.size()-1);
            std::shuffle(varArrOfTemp4.begin(),varArrOfTemp4.end(),randomNumber_mt19937_64);

            varChar = varArrOfTemp4[distr(gen)];

        }while(false);
        break;
    case 5:
        do{
            varArrOfTemp5 = CreateALotOfPasswords::kaArrOfHexadecimal_elem;
            std::uniform_int_distribution<long long> distr(0, varArrOfTemp5.size()-1);

            std::shuffle(varArrOfTemp5.begin(),varArrOfTemp5.end(),randomNumber_mt19937_64);

            varChar = varArrOfTemp5[distr(gen)];

        }while(false);
        break;
    default:
          varChar = 24;
        break;
    }

    return varChar;
}

/*
 * 对象计数器 取数
 * */
int CreateALotOfPasswords::sFunGetCounter()
{
    return sNewCounter;
}

/*
 * 重载 new
 * */
void *CreateALotOfPasswords::operator new(size_t s)
{
    ++sNewCounter;
    // 程序刚启动时加载配置文件之前是不显示的，因为debug开关标识还未被读取
    std::string str1 = "new of CreateALotOfPasswords : ";
    ChMSLog::funVoidViewCounter(str1,sNewCounter);
    return ::operator new(s);
}

/*
 * 重载 new
 * */
void *CreateALotOfPasswords::operator new(size_t s,void * p)
{
    ++sNewCounter;
    // 程序刚启动时加载配置文件之前是不显示的，因为debug开关标识还未被读取
    std::string str1 = "new of CreateALotOfPasswords : ";
    ChMSLog::funVoidViewCounter(str1,sNewCounter);
    return ::operator new(s,p);
}

/*
 * 重载 delete
 * */
void CreateALotOfPasswords::operator delete(void *ptr)
{
    --sNewCounter;
    std::string str1 = "delete of CreateALotOfPasswords : ";
    ChMSLog::funVoidViewCounter(str1,sNewCounter);
    return ::operator delete(ptr);
}






